Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for basic authentication #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zelda1link3
Copy link

For testing purposes trino uses default only admin as user. This allows this.

Copy link

cla-bot bot commented Jan 7, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@mosabua
Copy link
Member

mosabua commented Jan 7, 2025

Trino does NOT have a preconfigured admin user or anything like that so we should not hardcode a username in this class.

Ideally we should try to add a test for basic auth.

Commit message should be changed to

"Add support for basic authentication"

it should be suitable for any usage .. not just testing..

@zelda1link3
Copy link
Author

The default config from the trino helm chart creates a user named admin without a password. This was meant for this. The reason i say it is only for testing is that you don't want a authorization without passwords in production. That is why i want to discourage this. I will remove the default user and will add a simple unit test.

Copy link

cla-bot bot commented Jan 9, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@georgewfisher
Copy link
Contributor

The code looks similar to the LDAP auth implementation
Do we just want to modify LDAP auth with a "no password option"
Additionally, we could consider creating a new base class called BasicAuth and LDAP can derive from it

https://github.com/trinodb/trino-csharp-client/blob/5a7e91da6b65088ea7b34d6a55888c3e2c8b389a/trino-csharp/Trino.Client/Auth/LDAPAuth.cs

@zelda1link3
Copy link
Author

I think that you want to keep these 2 separate. The BasicAuth is very insecure and I would recommend no one to use in production and only for prototyping. I can change this code but is this really something that you want?

@zelda1link3 zelda1link3 changed the title Added BasicAuth for testing purposes Add support for basic authentication Jan 10, 2025
@mosabua
Copy link
Member

mosabua commented Jan 10, 2025

Why do you think BasicAuth is very insecure @zelda1link3 ... its just the usual username and password auth over HTTPS .. which then can be using different backends on the Trino side .. but thats kinda irrelevant.

HTTPS is required for any auth in Trino.

And if you are just talking about the default mode in which Trino can run on HTTP without any authentication but requires a username and no password .. yes thats insecure and if we need implementation for that it could be separate from BasicAuth .. or be the same with some override .. probably best if we do the same thing the JDBC driver does.. maybe @electrum or @wendigo can chime in here

@mosabua mosabua requested a review from georgewfisher January 10, 2025 16:20
@zelda1link3
Copy link
Author

The reason is that you only provide a username. So for that reason i think it is insecure to use this in production.

@mosabua
Copy link
Member

mosabua commented Jan 10, 2025

The reason is that you only provide a username. So for that reason i think it is insecure to use this in production.

Well.. that is the INSECURE configuration of the Trino cluster .. that does not make BasicAuthentication as such in the client library insecure .. as long as it can be used with password as well thats fine from my point of view.

@georgewfisher
Copy link
Contributor

BasicAuth should at least have an optional password field to make it complete (see https://www.rfc-editor.org/rfc/rfc7617). LDAPAuth can extend BasicAuth or not, but given that it uses the same username:password approach it probably should.

Copy link

cla-bot bot commented Jan 22, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@zelda1link3
Copy link
Author

I updated the code to reflect the reviews better. I also already send an email with the CLA but i think it still needs to be reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants